#include<iostream>
#include<cstring>
using namespace std;

char *func(char *s1,int n , char *s2)
{
    int length1 = strlen(s1);
    int length2 = strlen(s2);
    if (length1 < n)
    {
        return NULL;
    }
    
    char temp[length1 - n];
    for (int i = 0; i < length1; i++)
    {
        temp[i] = s1[n+i];
    }
    int j = 0;
    for (int i = n; i < length1 + length2; i++)
    {
        if (j < length2)
        {
            s1[i] = s2[j];
            j++;  
        }else{
            s1[i] = temp[j-length2];
            j++;
        }
    }
    
    return s1;
}


int main()
{
    char s1[12] = "hello world";
    char s2[10] = "12345678";
    func(s1,5,s2);
    cout << s1 << endl;

    return 0;
}